// 模拟后端动态生成路由

import { defineFakeRoute } from "vite-plugin-fake-server/client";

/**
 * roles：页面级别权限，这里模拟二种 "admin"、"common"
 * admin：管理员角色
 * common：普通角色
 */
const Router = [
  {
    path: "/cloudManagement",
    name: "cloudManagement",
    meta: {
      icon: "ep:folder-opened",
      title: "menus.cloudManagement",
      rank: 2,
      // roles: ["admin"],
      auth: ["btn:add", "btn:edit", "btn:delete"]
    },
    children: [
      {
        path: "/cloudManagement/myCloud/index",
        name: "myCloud",
        meta: {
          title: "menus.myCloud"
        }
      },
      {
        path: "/cloudManagement/recycleBin/index",
        name: "recycleBin",
        meta: {
          title: "menus.recycleBin"
        }
      }
    ]
  },
  {
    path: "/templateMarket",
    meta: {
      title: "menus.templateMarket",
      icon: "ep:shopping-trolley",
      rank: 3
    },
    children: [
      {
        path: "/templateMarket/index",
        name: "templateMarket",
        meta: {
          title: "menus.templateMarket"
        }
      }
    ]
  },

  {
    path: "/printerManagement",
    meta: {
      title: "menus.printerManagement",
      icon: "ep:printer",
      rank: 4
    },
    children: [
      {
        path: "/printerManagement/index",
        name: "printerManagement",
        meta: {
          title: "menus.printerManagement"
        }
      }
    ]
  },
  {
    path: "/system",
    meta: {
      icon: "ri:settings-3-line",
      title: "menus.pureSysManagement",
      rank: 13
    },
    children: [
      {
        path: "/system/user/index",
        name: "SystemUser",
        meta: {
          icon: "ri:admin-line",
          title: "menus.pureUser"
          // roles: ["admin"]
        }
      },
      {
        path: "/system/role/index",
        name: "SystemRole",
        meta: {
          icon: "ri:admin-fill",
          title: "menus.pureRole"
          // roles: ["admin"]
        }
      },
      {
        path: "/system/menu/index",
        name: "SystemMenu",
        meta: {
          icon: "ep:menu",
          title: "menus.pureSystemMenu"
          // roles: ["admin"]
        }
      }
    ]
  },
  {
    path: "/helpCenter",
    meta: {
      title: "menus.helpCenter",
      icon: "ep:help",
      rank: 5
    },
    children: [
      {
        path: "/helpCenter/index",
        name: "helpCenter",
        meta: {
          title: "menus.helpCenter"
        }
      }
    ]
  }
];

// const Router = [
//   {
//     id: 11,
//     parentId: 0,
//     name: "templateManagement",
//     path: "/templateManagement",
//     redirect: "",
//     component: "",
//     children: [
//       {
//         id: 12,
//         parentId: 11,
//         name: "myTemplate",
//         path: "/templateManagement/myTemplate/index",
//         redirect: "",
//         component: "",
//         meta: {
//           title: "menus.myTemplate",
//           icon: "",
//           extraIcon: "",
//           showLink: true,
//           showParent: false,
//           roles: ["admin"],
//           auths: null,
//           keepAlive: true,
//           frameSrc: "",
//           frameLoading: true,
//           hiddenTag: false,
//           dynamicLevel: null,
//           activePath: "",
//           transition: {
//             name: null,
//             enterTransition: "",
//             leaveTransition: ""
//           }
//         },
//         order: 99
//       },
//       {
//         id: 13,
//         parentId: 11,
//         name: "myFolde",
//         path: "/templateManagement/myFolder/index",
//         redirect: "",
//         component: "",
//         meta: {
//           title: "menus.myFolder",
//           icon: "",
//           extraIcon: "",
//           showLink: true,
//           showParent: false,
//           roles: ["admin"],
//           auths: null,
//           keepAlive: true,
//           frameSrc: "",
//           frameLoading: true,
//           hiddenTag: false,
//           dynamicLevel: null,
//           activePath: "",
//           transition: {
//             name: null,
//             enterTransition: "",
//             leaveTransition: ""
//           }
//         },
//         order: 99
//       }
//     ],
//     meta: {
//       title: "menus.templateManagement",
//       icon: "ep:folder-opened",
//       extraIcon: "",
//       showLink: true,
//       showParent: false,
//       roles: ["admin"],
//       auths: null,
//       keepAlive: true,
//       frameSrc: "",
//       frameLoading: true,
//       hiddenTag: false,
//       dynamicLevel: null,
//       activePath: "",
//       transition: {
//         name: null,
//         enterTransition: "",
//         leaveTransition: ""
//       }
//     },
//     order: 1
//   },
//   {
//     id: 14,
//     parentId: 0,
//     name: "pureSysManagement",
//     path: "/system",
//     redirect: "",
//     component: "",
//     children: [
//       {
//         id: 15,
//         parentId: 14,
//         name: "pureUser",
//         path: "/system/user/index",
//         redirect: "",
//         component: "",
//         meta: {
//           title: "menus.pureUser",
//           icon: "ri:admin-line",
//           extraIcon: "",
//           showLink: true,
//           showParent: false,
//           roles: ["admin"],
//           auths: null,
//           keepAlive: true,
//           frameSrc: "",
//           frameLoading: true,
//           hiddenTag: false,
//           dynamicLevel: null,
//           activePath: "",
//           transition: {
//             name: null,
//             enterTransition: "",
//             leaveTransition: ""
//           }
//         },
//         order: 99
//       },
//       {
//         id: 16,
//         parentId: 14,
//         name: "SystemRole",
//         path: "/system/role/index",
//         redirect: "",
//         component: "",
//         meta: {
//           title: "menus.pureRole",
//           icon: "ri:admin-fill",
//           extraIcon: "",
//           showLink: true,
//           showParent: false,
//           roles: ["admin"],
//           auths: null,
//           keepAlive: true,
//           frameSrc: "",
//           frameLoading: true,
//           hiddenTag: false,
//           dynamicLevel: null,
//           activePath: "",
//           transition: {
//             name: null,
//             enterTransition: "",
//             leaveTransition: ""
//           }
//         },
//         order: 99
//       }
//     ],
//     meta: {
//       title: "menus.pureSysManagement",
//       icon: "ri:settings-3-line",
//       extraIcon: "",
//       showLink: true,
//       showParent: false,
//       roles: ["admin"],
//       auths: null,
//       keepAlive: true,
//       frameSrc: "",
//       frameLoading: true,
//       hiddenTag: false,
//       dynamicLevel: null,
//       activePath: "",
//       transition: {
//         name: null,
//         enterTransition: "",
//         leaveTransition: ""
//       }
//     },
//     order: 6
//   }
// ];
export default defineFakeRoute([
  {
    url: "/get-async-routes",
    method: "get",
    response: () => {
      return {
        success: true,
        data: Router
      };
    }
  }
]);
